// import axios from 'axios'

import Vue from 'vue'
import App from './App'
import VueI18n from 'vue-i18n'
import VueRouter from 'vue-router'
import router from './router'
import store from './store/index'
import i18n from './api/lang' // 国际化
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/css/default.css' // 加载插件CSS 全局
import '@/api/public/prototype.js' // 加载插件JS 全局
// 挂载组件事件方法
import vueInherit from '@/api/vueInherit.js'
// 定义全局核心方法
import core from '@/assets/js/core.js'
// 定义bus组件通讯
import bus from '@/utils/bus'
// 全局定义 message  Notification 方法
import { ElMessage, ElNotification } from '@/assets/js/message.js'

// //qull-editor富文本引入
// import VueQuillEditor  from 'vue-quill-editor'
// import 'quill/dist/quill.core.css'
// import 'quill/dist/quill.snow.css'
// import 'quill/dist/quill.bubble.css'
 
// Vue.use(VueQuillEditor);


//引入图标组件 npm install e-icon-picker -S
import iconPicker from 'e-icon-picker';
import "e-icon-picker/lib/symbol.js"; //基本彩色图标库
import 'e-icon-picker/lib/index.css'; // 基本样式，包含基本图标
import 'font-awesome/css/font-awesome.min.css'; //font-awesome 图标库
import 'element-ui/lib/theme-chalk/icon.css'; //element-ui 图标库
Vue.use(iconPicker, { eIcon: true, ElementUI: true, FontAwesome: true, eIconSymbol: true });

//调用图片放大插件
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
//注册viewer
Vue.use(Viewer);
Viewer.setDefaults({
    Options: { "inline": true, "button": true, "navbar": true, "title": true, "toolbar": true, "tooltip": true, "movable": true, "zoomable": true, "rotatable": true, "scalable": true, "transition": true, "fullscreen": true, "keyboard": true, "url": "data-source" }
});

import requset from '@/assets/js/requset'

// 生产环境production 开发环境development
// axios.get('./jsondata/api.json').then(result => {
//     console.log(result, 1)
//     requset.defaults.baseURL = result.data.baseURL;
//     requset.defaults.withCredentials = false;
//     console.log(axios)
// }).catch(error => {
//     console.log('获取不到jsondata/api.json，请求路径将为相对路径/api/v1\n', error);
// })


// import $S from '$S'
// window.$S = $S;
//添加加密方式
import * as Base64 from 'js-base64'
Vue.use(Base64)
import md5 from 'js-md5';
Vue.prototype.$md5 = md5;



Vue.use(VueI18n)

// router路由跳转异常处理
Vue.use(VueRouter)
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
    return VueRouterPush.call(this, to).catch(err => err)
}

Vue.use(ElementUI)
Vue.use(ElementUI, {
    size: 'medium', // set element-ui default size
    i18n: (key, value) => i18n.t(key, value)
})

Vue.config.productionTip = false

Vue.prototype.$public = vueInherit

Vue.prototype.$core = core
Vue.prototype.$bus = bus
    // ajax请求方法
Vue.prototype.$http = requset

// 接下来就可以在组件通过 this.$msg    的方式调用了
Vue.prototype.$msg = new ElMessage()
Vue.prototype.$notify = new ElNotification()


new Vue({
    router,
    i18n,
    store,
    render: h => h(App)
}).$mount('#app')